<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  .box{
    width:300px;
    border:2px solid #f00;
    /* 创建BFC检测高度 */
    /* float: left; */
    /* display: inline-block/inline-flex/table; */
    /* display: inline-table/table/table-cell/table-caption */
    /* overflow: hidden;  只要不为visible就行 */
    /* position: absolute/fixed; */
  }
  .right , .left{
    float: left;
    width:100px ;
    height: 100px;
    background-color: pink;
  }
  .left{
    background-color: #00f;
  }
  </style>
</head>
<body>
  <div class="box">
    <div class="left"></div>
    <div class="right"></div>
  </div>
</body>
</html>